package com.yztstudy.Controller;

import com.wf.captcha.utils.CaptchaUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 验证码对应的表示层
 */

@Controller
@RequestMapping
public class CaptchaController {


    /**
     * TODO 生成验证码
     * @param request request作用域
     * @param response 发给前端的响应
     * @throws IOException
     */
    @GetMapping("/captcha")
    public void captcah(HttpServletRequest request, HttpServletResponse response) throws IOException {

        // TODO 1.自动生成验证码，并封装到request域内
        CaptchaUtil.out(request, response);
    }
}
